home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Devices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  26.5 KB  |  817 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Devices.h
  3.  
  4.      Contains:    Device Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DEVICES__
  18. #define __DEVICES__
  19.  
  20. #ifndef __OSUTILS__
  21. #include <OSUtils.h>
  22. #endif
  23. #ifndef __FILES__
  24. #include <Files.h>
  25. #endif
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. #ifndef __NAMEREGISTRY__
  30. #include <NameRegistry.h>
  31. #endif
  32. #ifndef __CODEFRAGMENTS__
  33. #include <CodeFragments.h>
  34. #endif
  35. #ifndef __DRIVERFAMILYMATCHING__
  36. #include <DriverFamilyMatching.h>
  37. #endif
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=mac68k
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61. /* Values of the 'message' parameter to a Chooser device package */
  62.  
  63. enum {
  64.     chooserInitMsg                = 11,                            /* the user selected this device package */
  65.     newSelMsg                    = 12,                            /* the user made new device selections */
  66.     fillListMsg                    = 13,                            /* fill the device list with choices */
  67.     getSelMsg                    = 14,                            /* mark one or more choices as selected */
  68.     selectMsg                    = 15,                            /* the user made a selection */
  69.     deselectMsg                    = 16,                            /* the user canceled a selection */
  70.     terminateMsg                = 17,                            /* allows device package to clean up */
  71.     buttonMsg                    = 19                            /* the user selected a button */
  72. };
  73.  
  74.  
  75. /* Values of the 'caller' parameter to a Chooser device package */
  76.  
  77. enum {
  78.     chooserID                    = 1
  79. };
  80.  
  81.  
  82. /* Values of the 'message' parameter to a Monitor 'mntr' */
  83.  
  84. enum {
  85.     initMsg                        = 1,                            /*initialization*/
  86.     okMsg                        = 2,                            /*user clicked OK button*/
  87.     cancelMsg                    = 3,                            /*user clicked Cancel button*/
  88.     hitMsg                        = 4,                            /*user clicked control in Options dialog*/
  89.     nulMsg                        = 5,                            /*periodic event*/
  90.     updateMsg                    = 6,                            /*update event*/
  91.     activateMsg                    = 7,                            /*not used*/
  92.     deactivateMsg                = 8,                            /*not used*/
  93.     keyEvtMsg                    = 9,                            /*keyboard event*/
  94.     superMsg                    = 10,                            /*show superuser controls*/
  95.     normalMsg                    = 11,                            /*show only normal controls*/
  96.     startupMsg                    = 12                            /*code has been loaded*/
  97. };
  98.  
  99.  
  100. /* control codes for DeskAccessories */
  101.  
  102. enum {
  103.     goodbye                        = -1,                            /* heap being reinitialized */
  104.     killCode                    = 1,                            /* KillIO requested */
  105.     accEvent                    = 64,                            /* handle an event */
  106.     accRun                        = 65,                            /* time for periodic action */
  107.     accCursor                    = 66,                            /* change cursor shape */
  108.     accMenu                        = 67,                            /* handle menu item */
  109.     accUndo                        = 68,                            /* handle undo command */
  110.     accCut                        = 70,                            /* handle cut command */
  111.     accCopy                        = 71,                            /* handle copy command */
  112.     accPaste                    = 72,                            /* handle paste command */
  113.     accClear                    = 73                            /* handle clear command */
  114. };
  115.  
  116. /* Control/Status Call Codes */
  117.  
  118. enum {
  119.     drvStsCode                    = 8,                            /* status call code for drive status */
  120.     ejectCode                    = 7,                            /* control call eject code */
  121.     tgBuffCode                    = 8                                /* set tag buffer code */
  122. };
  123.  
  124. /* miscellaneous Device Manager constants */
  125.  
  126. enum {
  127.     ioInProgress                = 1,                            /* predefined value of ioResult while I/O is pending */
  128.     aRdCmd                        = 2,                            /* low byte of ioTrap for Read calls */
  129.     aWrCmd                        = 3,                            /* low byte of ioTrap for Write calls */
  130.     asyncTrpBit                    = 10,                            /* trap word modifier */
  131.     noQueueBit                    = 9                                /* trap word modifier */
  132. };
  133.  
  134. /* flags used in the driver header and device control entry */
  135.  
  136. enum {
  137.     dReadEnable                    = 0,                            /* set if driver responds to read requests */
  138.     dWritEnable                    = 1,                            /* set if driver responds to write requests */
  139.     dCtlEnable                    = 2,                            /* set if driver responds to control requests */
  140.     dStatEnable                    = 3,                            /* set if driver responds to status requests */
  141.     dNeedGoodBye                = 4,                            /* set if driver needs time for performing periodic tasks */
  142.     dNeedTime                    = 5,                            /* set if driver needs time for performing periodic tasks */
  143.     dNeedLock                    = 6                                /* set if driver must be locked in memory as soon as it is opened */
  144. };
  145.  
  146.  
  147. enum {
  148.     dNeedLockMask                = 0x4000,                        /* set if driver must be locked in memory as soon as it is opened */
  149.     dNeedTimeMask                = 0x2000,                        /* set if driver needs time for performing periodic tasks */
  150.     dNeedGoodByeMask            = 0x1000,                        /* set if driver needs to be called before the application heap is initialized */
  151.     dStatEnableMask                = 0x0800,                        /* set if driver responds to status requests */
  152.     dCtlEnableMask                = 0x0400,                        /* set if driver responds to control requests */
  153.     dWritEnableMask                = 0x0200,                        /* set if driver responds to write requests */
  154.     dReadEnableMask                = 0x0100                        /* set if driver responds to read requests */
  155. };
  156.  
  157.  
  158. /* run-time flags used in the device control entry */
  159.  
  160. enum {
  161.     dOpened                        = 5,                            /* driver is open */
  162.     dRAMBased                    = 6,                            /* dCtlDriver is a handle (1) or pointer (0) */
  163.     drvrActive                    = 7                                /* driver is currently processing a request */
  164. };
  165.  
  166.  
  167. enum {
  168.     drvrActiveMask                = 0x0080,                        /* driver is currently processing a request */
  169.     dRAMBasedMask                = 0x0040,                        /* dCtlDriver is a handle (1) or pointer (0) */
  170.     dOpenedMask                    = 0x0020                        /* driver is open */
  171. };
  172.  
  173.  
  174.  
  175. struct DRVRHeader {
  176.     short                             drvrFlags;
  177.     short                             drvrDelay;
  178.     short                             drvrEMask;
  179.     short                             drvrMenu;
  180.     short                             drvrOpen;
  181.     short                             drvrPrime;
  182.     short                             drvrCtl;
  183.     short                             drvrStatus;
  184.     short                             drvrClose;
  185.     unsigned char                     drvrName[1];
  186. };
  187. typedef struct DRVRHeader                DRVRHeader;
  188. typedef DRVRHeader *                    DRVRHeaderPtr;
  189. typedef DRVRHeaderPtr *                    DRVRHeaderHandle;
  190.  
  191. struct DCtlEntry {
  192.     Ptr                             dCtlDriver;
  193.     short                             dCtlFlags;
  194.     QHdr                             dCtlQHdr;
  195.     long                             dCtlPosition;
  196.     Handle                             dCtlStorage;
  197.     short                             dCtlRefNum;
  198.     long                             dCtlCurTicks;
  199.     GrafPtr                         dCtlWindow;
  200.     short                             dCtlDelay;
  201.     short                             dCtlEMask;
  202.     short                             dCtlMenu;
  203. };
  204. typedef struct DCtlEntry                DCtlEntry;
  205.  
  206. typedef DCtlEntry *                        DCtlPtr;
  207. typedef DCtlPtr *                        DCtlHandle;
  208.  
  209. struct AuxDCE {
  210.     Ptr                             dCtlDriver;
  211.     short                             dCtlFlags;
  212.     QHdr                             dCtlQHdr;
  213.     long                             dCtlPosition;
  214.     Handle                             dCtlStorage;
  215.     short                             dCtlRefNum;
  216.     long                             dCtlCurTicks;
  217.     GrafPtr                         dCtlWindow;
  218.     short                             dCtlDelay;
  219.     short                             dCtlEMask;
  220.     short                             dCtlMenu;
  221.     SInt8                             dCtlSlot;
  222.     SInt8                             dCtlSlotId;
  223.     long                             dCtlDevBase;
  224.     Ptr                             dCtlOwner;
  225.     SInt8                             dCtlExtDev;
  226.     SInt8                             fillByte;
  227.     UInt32                             dCtlNodeID;
  228. };
  229. typedef struct AuxDCE                    AuxDCE;
  230. typedef AuxDCE *                        AuxDCEPtr;
  231. typedef AuxDCEPtr *                        AuxDCEHandle;
  232. /*    The NDRV Driver IO Entry Point and Commands */
  233.  
  234. typedef UInt16                             UnitNumber;
  235. typedef UInt32                             DriverOpenCount;
  236. typedef SInt16                             DriverRefNum;
  237. typedef SInt16                             DriverFlags;
  238. typedef UInt32                             IOCommandCode;
  239.  
  240. enum {
  241.     kOpenCommand                = 0,
  242.     kCloseCommand                = 1,
  243.     kReadCommand                = 2,
  244.     kWriteCommand                = 3,
  245.     kControlCommand                = 4,
  246.     kStatusCommand                = 5,
  247.     kKillIOCommand                = 6,
  248.     kInitializeCommand            = 7,                            /* init driver and device*/
  249.     kFinalizeCommand            = 8,                            /* shutdown driver and device*/
  250.     kReplaceCommand                = 9,                            /* replace an old driver*/
  251.     kSupersededCommand            = 10,                            /* prepare to be replaced by a new driver*/
  252.     kSuspendCommand                = 11,                            /* prepare driver to go to sleep*/
  253.     kResumeCommand                = 12                            /* wake up sleeping driver*/
  254. };
  255.  
  256. typedef struct OpaqueAddressSpaceID*     AddressSpaceID;
  257. typedef struct OpaqueIOCommandID*         IOCommandID;
  258. typedef UInt32                             IOCommandKind;
  259.  
  260. enum {
  261.     kSynchronousIOCommandKind    = 0x00000001,
  262.     kAsynchronousIOCommandKind    = 0x00000002,
  263.     kImmediateIOCommandKind        = 0x00000004
  264. };
  265.  
  266.  
  267. struct DriverInitInfo {
  268.     DriverRefNum                     refNum;
  269.     RegEntryID                         deviceEntry;
  270. };
  271. typedef struct DriverInitInfo            DriverInitInfo;
  272. typedef DriverInitInfo *                DriverInitInfoPtr;
  273.  
  274. typedef DriverInitInfo                     DriverReplaceInfo;
  275. typedef DriverInitInfo *                DriverReplaceInfoPtr;
  276.  
  277. struct DriverFinalInfo {
  278.     DriverRefNum                     refNum;
  279.     RegEntryID                         deviceEntry;
  280. };
  281. typedef struct DriverFinalInfo            DriverFinalInfo;
  282. typedef DriverFinalInfo *                DriverFinalInfoPtr;
  283.  
  284. typedef DriverFinalInfo                 DriverSupersededInfo;
  285. typedef DriverFinalInfo *                DriverSupersededInfoPtr;
  286.  
  287. /* Contents are command specific*/
  288.  
  289.  
  290. union IOCommandContents {
  291.     ParmBlkPtr                         pb;
  292.     DriverInitInfoPtr                 initialInfo;
  293.     DriverFinalInfoPtr                 finalInfo;
  294.     DriverReplaceInfoPtr             replaceInfo;
  295.     DriverSupersededInfoPtr         supersededInfo;
  296. };
  297. typedef union IOCommandContents            IOCommandContents;
  298. typedef CALLBACK_API_C( OSErr , DriverEntryPointPtr )(AddressSpaceID SpaceID, IOCommandID CommandID, IOCommandContents Contents, IOCommandCode Code, IOCommandKind Kind);
  299. /* Record to describe a file-based driver candidate */
  300.  
  301. struct FileBasedDriverRecord {
  302.     FSSpec                             theSpec;                    /* file specification*/
  303.     MacDriverType                     theType;                    /* nameInfoStr + version number*/
  304.     Boolean                         compatibleProp;                /* true if matched using a compatible name*/
  305.     UInt8                             pad[3];                        /* alignment*/
  306. };
  307. typedef struct FileBasedDriverRecord    FileBasedDriverRecord;
  308. typedef FileBasedDriverRecord *            FileBasedDriverRecordPtr;
  309. /* Detailed Record to describe a file-based driver candidate. Includes fragment name */
  310.  
  311. struct FileBasedDriverDetailed {
  312.     FileBasedDriverRecord             fileBasedDriver;
  313.     Str63                             fragName;
  314. };
  315. typedef struct FileBasedDriverDetailed    FileBasedDriverDetailed;
  316. typedef FileBasedDriverDetailed *        FileBasedDriverDetailedPtr;
  317. /* Driver Loader API */
  318. #define DECLARE_DRIVERDESCRIPTION(N_ADDITIONAL_SERVICES)\
  319.         struct {\
  320.             DriverDescription    fixed;\
  321.             DriverServiceInfo    additional_service[N_ADDITIONAL_SERVICES-1];\
  322.         };
  323.  
  324.  
  325. EXTERN_API_C( SInt16 )
  326. HigherDriverVersion                (NumVersion *            driverVersion1,
  327.                                  NumVersion *            driverVersion2);
  328.  
  329. EXTERN_API_C( OSErr )
  330. VerifyFragmentAsDriver            (CFragConnectionID         fragmentConnID,
  331.                                  DriverEntryPointPtr *    fragmentMain,
  332.                                  DriverDescriptionPtr *    driverDesc);
  333.  
  334. EXTERN_API_C( OSErr )
  335. GetDriverMemoryFragment            (Ptr                     memAddr,
  336.                                  long                     length,
  337.                                  ConstStr63Param         fragName,
  338.                                  CFragConnectionID *    fragmentConnID,
  339.                                  DriverEntryPointPtr *    fragmentMain,
  340.                                  DriverDescriptionPtr *    driverDesc);
  341.  
  342. EXTERN_API_C( OSErr )
  343. GetDriverDiskFragment            (FSSpecPtr                 fragmentSpec,
  344.                                  CFragConnectionID *    fragmentConnID,
  345.                                  DriverEntryPointPtr *    fragmentMain,
  346.                                  DriverDescriptionPtr *    driverDesc);
  347.  
  348. EXTERN_API_C( OSErr )
  349. GetNamedDriverDiskFragment        (FSSpecPtr                 fragmentSpec,
  350.                                  ConstStr63Param         fragName,
  351.                                  CFragConnectionID *    fragmentConnID,
  352.                                  DriverEntryPointPtr *    fragmentMain,
  353.                                  DriverDescriptionPtr *    driverDesc);
  354.  
  355. EXTERN_API_C( OSErr )
  356. InstallDriverFromFragment        (CFragConnectionID         fragmentConnID,
  357.                                  RegEntryID *            device,
  358.                                  UnitNumber             beginningUnit,
  359.                                  UnitNumber             endingUnit,
  360.                                  DriverRefNum *            refNum);
  361.  
  362. EXTERN_API_C( OSErr )
  363. InstallDriverFromFile            (FSSpecPtr                 fragmentSpec,
  364.                                  RegEntryID *            device,
  365.                                  UnitNumber             beginningUnit,
  366.                                  UnitNumber             endingUnit,
  367.                                  DriverRefNum *            refNum);
  368.  
  369. EXTERN_API_C( OSErr )
  370. InstallDriverFromMemory            (Ptr                     memory,
  371.                                  long                     length,
  372.                                  ConstStr63Param         fragName,
  373.                                  RegEntryID *            device,
  374.                                  UnitNumber             beginningUnit,
  375.                                  UnitNumber             endingUnit,
  376.                                  DriverRefNum *            refNum);
  377.  
  378. EXTERN_API_C( OSErr )
  379. InstallDriverFromResource        (SInt16                 theRsrcID,
  380.                                  ConstStr255Param         theRsrcName,
  381.                                  RegEntryIDPtr             theDevice,
  382.                                  UnitNumber             theBeginningUnit,
  383.                                  UnitNumber             theEndingUnit,
  384.                                  DriverRefNum *            theRefNum);
  385.  
  386. EXTERN_API_C( OSErr )
  387. InstallDriverFromDisk            (Ptr                     theDriverName,
  388.                                  RegEntryID *            theDevice,
  389.                                  UnitNumber             theBeginningUnit,
  390.                                  UnitNumber             theEndingUnit,
  391.                                  DriverRefNum *            theRefNum);
  392.  
  393. EXTERN_API_C( OSErr )
  394. FindDriversForDevice            (RegEntryID *            device,
  395.                                  FSSpec *                fragmentSpec,
  396.                                  DriverDescription *    fileDriverDesc,
  397.                                  Ptr *                    memAddr,
  398.                                  long *                    length,
  399.                                  StringPtr                 fragName,
  400.                                  DriverDescription *    memDriverDesc);
  401.  
  402. EXTERN_API_C( OSErr )
  403. FindDriverForDeviceFromFile        (RegEntryID *            device,
  404.                                  FSSpec *                fragmentSpec,
  405.                                  DriverDescription *    driverDesc,
  406.                                  StringPtr                 fragName);
  407.  
  408. EXTERN_API_C( OSErr )
  409. FindDriverCandidates            (RegEntryID *            deviceID,
  410.                                  Ptr *                    propBasedDriver,
  411.                                  RegPropertyValueSize *    propBasedDriverSize,
  412.                                  StringPtr                 deviceName,
  413.                                  MacDriverType *        propBasedDriverType,
  414.                                  Boolean *                gotPropBasedDriver,
  415.                                  FileBasedDriverRecordPtr  fileBasedDrivers,
  416.                                  ItemCount *            nFileBasedDrivers);
  417.  
  418. EXTERN_API_C( OSErr )
  419. FindDriverCandidatesDetailed    (RegEntryIDPtr             deviceID,
  420.                                  Ptr *                    propBasedDriver,
  421.                                  RegPropertyValueSize *    propBasedDriverSize,
  422.                                  StringPtr                 deviceName,
  423.                                  MacDriverType *        propBasedDriverType,
  424.                                  Boolean *                gotPropBasedDriver,
  425.                                  FileBasedDriverDetailedPtr  fileBasedDrivers,
  426.                                  ItemCount *            nFileBasedDrivers);
  427.  
  428. EXTERN_API_C( OSErr )
  429. ScanDriverCandidates            (RegEntryID *            deviceID,
  430.                                  FileBasedDriverRecordPtr  fileBasedDrivers,
  431.                                  ItemCount                 nFileBasedDrivers,
  432.                                  FileBasedDriverRecordPtr  matchingDrivers,
  433.                                  ItemCount *            nMatchingDrivers);
  434.  
  435. EXTERN_API_C( OSErr )
  436. ScanDriverCandidatesDetailed    (RegEntryID *            deviceID,
  437.                                  FileBasedDriverDetailedPtr  fileBasedDrivers,
  438.                                  ItemCount                 nFileBasedDrivers,
  439.                                  FileBasedDriverDetailedPtr  matchingDrivers,
  440.                                  ItemCount *            nMatchingDrivers);
  441.  
  442. EXTERN_API_C( SInt16 )
  443. CompareFileCandToPropCand        (RegEntryID *            device,
  444.                                  StringPtr                 deviceName,
  445.                                  DriverTypePtr             propBasedCandidate,
  446.                                  FileBasedDriverRecordPtr  fileBasedCandidate);
  447.  
  448. EXTERN_API_C( void )
  449. GetCompatibleProperty            (RegEntryID *            device,
  450.                                  StringPtr *            compatibleNames,
  451.                                  ItemCount *            nCompatibleNames);
  452.  
  453. EXTERN_API_C( Boolean )
  454. CompatibleDriverNames            (StringPtr                 nameInfoStr,
  455.                                  StringPtr                 compatibleNames,
  456.                                  ItemCount                 nCompatibleNames,
  457.                                  long *                    nameCount);
  458.  
  459. EXTERN_API_C( OSErr )
  460. GetDriverForDevice                (RegEntryID *            device,
  461.                                  CFragConnectionID *    fragmentConnID,
  462.                                  DriverEntryPointPtr *    fragmentMain,
  463.                                  DriverDescriptionPtr *    driverDesc);
  464.  
  465. EXTERN_API_C( OSErr )
  466. InstallDriverForDevice            (RegEntryID *            device,
  467.                                  UnitNumber             beginningUnit,
  468.                                  UnitNumber             endingUnit,
  469.                                  DriverRefNum *            refNum);
  470.  
  471. EXTERN_API_C( OSErr )
  472. GetDriverInformation            (DriverRefNum             refNum,
  473.                                  UnitNumber *            unitNum,
  474.                                  DriverFlags *            flags,
  475.                                  DriverOpenCount *        count,
  476.                                  StringPtr                 name,
  477.                                  RegEntryID *            device,
  478.                                  CFragSystem7Locator *    driverLoadLocation,
  479.                                  CFragConnectionID *    fragmentConnID,
  480.                                  DriverEntryPointPtr *    fragmentMain,
  481.                                  DriverDescription *    driverDesc);
  482.  
  483. EXTERN_API_C( OSErr )
  484. GetDriverDescription            (LogicalAddress         fragmentPtr,
  485.                                  DriverDescriptionPtr *    theDriverDesc);
  486.  
  487. EXTERN_API_C( OSStatus )
  488. GetNamedDriverDescFromFSSpec    (FSSpecPtr                 fragmentSpec,
  489.                                  StringPtr                 fragName,
  490.                                  DriverDescriptionPtr *    driverDesc);
  491.  
  492. EXTERN_API_C( OSErr )
  493. SetDriverClosureMemory            (CFragConnectionID         fragmentConnID,
  494.                                  Boolean                 holdDriverMemory);
  495.  
  496. EXTERN_API_C( OSErr )
  497. ReplaceDriverWithFragment        (DriverRefNum             theRefNum,
  498.                                  CFragConnectionID         fragmentConnID);
  499.  
  500. EXTERN_API_C( OSErr )
  501. OpenInstalledDriver                (DriverRefNum             refNum,
  502.                                  SInt8                     ioPermission);
  503.  
  504. EXTERN_API_C( OSErr )
  505. RenameDriver                    (DriverRefNum             refNum,
  506.                                  StringPtr                 newDriverName);
  507.  
  508. EXTERN_API_C( OSErr )
  509. RemoveDriver                    (DriverRefNum             refNum,
  510.                                  Boolean                 immediate);
  511.  
  512. EXTERN_API_C( OSErr )
  513. LookupDrivers                    (UnitNumber             beginningUnit,
  514.                                  UnitNumber             endingUnit,
  515.                                  Boolean                 emptyUnits,
  516.                                  ItemCount *            returnedRefNums,
  517.                                  DriverRefNum *            refNums);
  518.  
  519. EXTERN_API_C( UnitNumber )
  520. HighestUnitNumber                (void);
  521.  
  522. EXTERN_API_C( OSErr )
  523. DriverGestaltOn                    (DriverRefNum             refNum);
  524.  
  525. EXTERN_API_C( OSErr )
  526. DriverGestaltOff                (DriverRefNum             refNum);
  527.  
  528. EXTERN_API_C( Boolean )
  529. DriverGestaltIsOn                (DriverFlags             flags);
  530.  
  531.  
  532. #if !OLDROUTINELOCATIONS
  533.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  534.                                                                                             #pragma parameter __D0 PBOpenSync(__A0)
  535.                                                                                             #endif
  536. EXTERN_API( OSErr )
  537. PBOpenSync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA000);
  538.  
  539.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  540.                                                                                             #pragma parameter __D0 PBOpenAsync(__A0)
  541.                                                                                             #endif
  542. EXTERN_API( OSErr )
  543. PBOpenAsync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA400);
  544.  
  545.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  546.                                                                                             #pragma parameter __D0 PBOpenImmed(__A0)
  547.                                                                                             #endif
  548. EXTERN_API( OSErr )
  549. PBOpenImmed                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA200);
  550.  
  551.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  552.                                                                                             #pragma parameter __D0 PBCloseSync(__A0)
  553.                                                                                             #endif
  554. EXTERN_API( OSErr )
  555. PBCloseSync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA001);
  556.  
  557.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  558.                                                                                             #pragma parameter __D0 PBCloseAsync(__A0)
  559.                                                                                             #endif
  560. EXTERN_API( OSErr )
  561. PBCloseAsync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA401);
  562.  
  563.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  564.                                                                                             #pragma parameter __D0 PBCloseImmed(__A0)
  565.                                                                                             #endif
  566. EXTERN_API( OSErr )
  567. PBCloseImmed                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA201);
  568.  
  569.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  570.                                                                                             #pragma parameter __D0 PBReadSync(__A0)
  571.                                                                                             #endif
  572. EXTERN_API( OSErr )
  573. PBReadSync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA002);
  574.  
  575.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  576.                                                                                             #pragma parameter __D0 PBReadAsync(__A0)
  577.                                                                                             #endif
  578. EXTERN_API( OSErr )
  579. PBReadAsync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA402);
  580.  
  581.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  582.                                                                                             #pragma parameter __D0 PBReadImmed(__A0)
  583.                                                                                             #endif
  584. EXTERN_API( OSErr )
  585. PBReadImmed                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA202);
  586.  
  587.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  588.                                                                                             #pragma parameter __D0 PBWriteSync(__A0)
  589.                                                                                             #endif
  590. EXTERN_API( OSErr )
  591. PBWriteSync                        (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA003);
  592.  
  593.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  594.                                                                                             #pragma parameter __D0 PBWriteAsync(__A0)
  595.                                                                                             #endif
  596. EXTERN_API( OSErr )
  597. PBWriteAsync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA403);
  598.  
  599.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  600.                                                                                             #pragma parameter __D0 PBWriteImmed(__A0)
  601.                                                                                             #endif
  602. EXTERN_API( OSErr )
  603. PBWriteImmed                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA203);
  604.  
  605. EXTERN_API( void )
  606. AddDrive                        (short                     drvrRefNum,
  607.                                  short                     drvNum,
  608.                                  DrvQElPtr                 qEl);
  609.  
  610. EXTERN_API( QHdrPtr )
  611. GetDrvQHdr                        (void)                                                        THREEWORDINLINE(0x2EBC, 0x0000, 0x0308);
  612.  
  613. #endif  /* !OLDROUTINELOCATIONS */
  614.  
  615. EXTERN_API( DCtlHandle )
  616. GetDCtlEntry                    (short                     refNum);
  617.  
  618. /*
  619.     SetChooserAlert used to simply set a bit in a low-mem global
  620.     to tell the Chooser not to display its warning message when
  621.     the printer is changed. However, under MultiFinder and System 7,
  622.     this low-mem is swapped out when a layer change occurs, and the
  623.     Chooser never sees the change. It is obsolete, and completely
  624.     unsupported on the PowerPC. 68K apps can still call it if they
  625.     wish.
  626.     
  627.     pascal Boolean SetChooserAlert(Boolean f);
  628.  
  629. */
  630.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  631.                                                                                             #pragma parameter __D0 DriverInstall(__A0, __D0)
  632.                                                                                             #endif
  633. EXTERN_API( OSErr )
  634. DriverInstall                    (DRVRHeaderPtr             drvrPtr,
  635.                                  short                     refNum)                                ONEWORDINLINE(0xA03D);
  636.  
  637.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  638.                                                                                             #pragma parameter __D0 DriverInstallReserveMem(__A0, __D0)
  639.                                                                                             #endif
  640. EXTERN_API( OSErr )
  641. DriverInstallReserveMem            (DRVRHeaderPtr             drvrPtr,
  642.                                  short                     refNum)                                ONEWORDINLINE(0xA43D);
  643.  
  644. /*
  645.   Note: DrvrInstall() is no longer supported, becuase it never really worked anyways.
  646.           There will soon be a DriverInstall() which does the right thing.
  647.  
  648.         DrvrRemove has been renamed to DriverRemove.  But, InterfaceLib for PowerPC
  649.         still exports DrvrRemove, so a macro is used to map the new name to old.
  650.  
  651. */
  652.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  653.                                                                                             #pragma parameter __D0 DrvrRemove(__D0)
  654.                                                                                             #endif
  655. EXTERN_API( OSErr )
  656. DrvrRemove                        (short                     refNum)                                ONEWORDINLINE(0xA03E);
  657.  
  658. #define DriverRemove(refNum) DrvrRemove(refNum)
  659.  
  660. #if TARGET_OS_MAC
  661.     #define MacOpenDriver OpenDriver
  662. #endif
  663. EXTERN_API( OSErr )
  664. MacOpenDriver                    (ConstStr255Param         name,
  665.                                  short *                drvrRefNum);
  666.  
  667. #if TARGET_OS_MAC
  668.     #define MacCloseDriver CloseDriver
  669. #endif
  670. EXTERN_API( OSErr )
  671. MacCloseDriver                    (short                     refNum);
  672.  
  673. EXTERN_API( OSErr )
  674. Control                            (short                     refNum,
  675.                                  short                     csCode,
  676.                                  const void *            csParamPtr);
  677.  
  678. EXTERN_API( OSErr )
  679. Status                            (short                     refNum,
  680.                                  short                     csCode,
  681.                                  void *                    csParamPtr);
  682.  
  683. EXTERN_API( OSErr )
  684. KillIO                            (short                     refNum);
  685.  
  686.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  687.                                                                                             #pragma parameter __D0 Fetch(__A1)
  688.                                                                                             #endif
  689. EXTERN_API( long )
  690. Fetch                            (DCtlPtr                 dce)                                THREEWORDINLINE(0x2078, 0x08F4, 0x4E90);
  691.  
  692.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  693.                                                                                             #pragma parameter __D0 Stash(__A1, __D0)
  694.                                                                                             #endif
  695. EXTERN_API( long )
  696. Stash                            (DCtlPtr                 dce,
  697.                                  char                     data)                                THREEWORDINLINE(0x2078, 0x08F8, 0x4E90);
  698.  
  699.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  700.                                                                                             #pragma parameter IODone(__A1, __D0)
  701.                                                                                             #endif
  702. EXTERN_API( void )
  703. IODone                            (DCtlPtr                 dce,
  704.                                  OSErr                     ioResult)                            THREEWORDINLINE(0x2078, 0x08FC, 0x4E90);
  705.  
  706.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  707.                                                                                             #pragma parameter __D0 PBControlSync(__A0)
  708.                                                                                             #endif
  709. EXTERN_API( OSErr )
  710. PBControlSync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA004);
  711.  
  712.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  713.                                                                                             #pragma parameter __D0 PBControlAsync(__A0)
  714.                                                                                             #endif
  715. EXTERN_API( OSErr )
  716. PBControlAsync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA404);
  717.  
  718.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  719.                                                                                             #pragma parameter __D0 PBControlImmed(__A0)
  720.                                                                                             #endif
  721. EXTERN_API( OSErr )
  722. PBControlImmed                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA204);
  723.  
  724.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  725.                                                                                             #pragma parameter __D0 PBStatusSync(__A0)
  726.                                                                                             #endif
  727. EXTERN_API( OSErr )
  728. PBStatusSync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA005);
  729.  
  730.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  731.                                                                                             #pragma parameter __D0 PBStatusAsync(__A0)
  732.                                                                                             #endif
  733. EXTERN_API( OSErr )
  734. PBStatusAsync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA405);
  735.  
  736.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  737.                                                                                             #pragma parameter __D0 PBStatusImmed(__A0)
  738.                                                                                             #endif
  739. EXTERN_API( OSErr )
  740. PBStatusImmed                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA205);
  741.  
  742.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  743.                                                                                             #pragma parameter __D0 PBKillIOSync(__A0)
  744.                                                                                             #endif
  745. EXTERN_API( OSErr )
  746. PBKillIOSync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA006);
  747.  
  748.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  749.                                                                                             #pragma parameter __D0 PBKillIOAsync(__A0)
  750.                                                                                             #endif
  751. EXTERN_API( OSErr )
  752. PBKillIOAsync                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA406);
  753.  
  754.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  755.                                                                                             #pragma parameter __D0 PBKillIOImmed(__A0)
  756.                                                                                             #endif
  757. EXTERN_API( OSErr )
  758. PBKillIOImmed                    (ParmBlkPtr             paramBlock)                            ONEWORDINLINE(0xA206);
  759.  
  760. EXTERN_API( short )
  761. OpenDeskAcc                        (ConstStr255Param         deskAccName)                        ONEWORDINLINE(0xA9B6);
  762.  
  763. EXTERN_API( void )
  764. CloseDeskAcc                    (short                     refNum)                                ONEWORDINLINE(0xA9B7);
  765.  
  766. #if CGLUESUPPORTED
  767. EXTERN_API_C( short )
  768. opendeskacc                        (const char *            deskAccName);
  769.  
  770. EXTERN_API_C( OSErr )
  771. opendriver                        (const char *            driverName,
  772.                                  short *                refNum);
  773.  
  774. #endif  /* CGLUESUPPORTED */
  775.  
  776. /*
  777.     The PBxxx() routines are obsolete.  
  778.     
  779.     Use the PBxxxSync(), PBxxxAsync(), or PBxxxImmed version instead.
  780. */
  781. #define PBControl(pb, async) ((async) ? PBControlAsync(pb) : PBControlSync(pb))
  782. #define PBStatus(pb, async) ((async) ? PBStatusAsync(pb) : PBStatusSync(pb))
  783. #define PBKillIO(pb, async) ((async) ? PBKillIOAsync(pb) : PBKillIOSync(pb))
  784.  
  785. #if !OLDROUTINELOCATIONS
  786. #define PBOpen(pb, async) ((async) ? PBOpenAsync(pb) : PBOpenSync(pb))
  787. #define PBClose(pb, async) ((async) ? PBCloseAsync(pb) : PBCloseSync(pb))
  788. #define PBRead(pb, async) ((async) ? PBReadAsync(pb) : PBReadSync(pb))
  789. #define PBWrite(pb, async) ((async) ? PBWriteAsync(pb) : PBWriteSync(pb))
  790. #endif  /* !OLDROUTINELOCATIONS */
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797. #if PRAGMA_STRUCT_ALIGN
  798.     #pragma options align=reset
  799. #elif PRAGMA_STRUCT_PACKPUSH
  800.     #pragma pack(pop)
  801. #elif PRAGMA_STRUCT_PACK
  802.     #pragma pack()
  803. #endif
  804.  
  805. #ifdef PRAGMA_IMPORT_OFF
  806. #pragma import off
  807. #elif PRAGMA_IMPORT
  808. #pragma import reset
  809. #endif
  810.  
  811. #ifdef __cplusplus
  812. }
  813. #endif
  814.  
  815. #endif /* __DEVICES__ */
  816.  
  817.